import request from '@/utils/request'
// 创建新订单
export function makeNewSale() {
    return request({
      url: '/sale/new',
      method: 'post',
    })
  }
// 根据商品编码查询商品规格
export function getSpecificationList(data) {
    return request({
        url:'sale/post/spe/list?productSn='+data,
        method:'post',
    })
}
// 录入商品
export function enterItem(data){
  return request({
    url:'sale/add/item',
    method:'post',
    data:data
})
}
// 结束订单
export function endSale(data){
  return request({
    url:'sale/end',
    method:'post',
    data:data==='null'?null:data
})
}
// 现金支付
export function payByCash(data){
  return request({
    url:'/pay/cash',
    method:'post',
    data: {
      ...data
    }
})
}
// 添加备注
// export function addNote(data){
//   return request({
//     url:'sale/add/note?note='+data,
//     method:'post',
// })
// }
// 挂单
export function pendingSale(data){
  return request({
    url:'sale/pending',
    method:'post',
    data:data==='null'?null:data
})
}
// 获得未完成订单
export function getUnfinishedSale(data){
  return request({
    url:'sale/get/unfinished',
    method:'post',
    data:data
})
}
// 加载未完成的销售
export function loadSale(data){
  return request({
    url:'sale/load?saleNo='+data,
    method:'post',
    data:data
})
}
// 删除商品
export function deleteItem(productSn,speId){
  return request({
    url:'sale/remove/item?productSn=' + productSn + '&speId=' + speId,
    method:'post',
})
}
// 修改商品数量、规格
export function changeSaleItem(data){
  return request({
    url:'sale/change/item',
    method:'post',
    data:data
})
}
// 取消订单
export function cancelOrder(data){
  return request({
    url:'sale/cancel/sale?saleNo='+data,
    method:'post',
})
}

// 查询订单支付明细
export function getPayDetail(saleNo){
  return request({
    url:'sale/pay-detail?saleNo='+saleNo,
    method:'get',
})
}

// 查询单个已支付的订单详情
export function getPaidOrderDeatil(saleNo){
  return request({
    url:'sale/get/paid?saleNo='+saleNo,
    method:'get',
})
}
